# 分割字符串
csv_data = "apple,banana,orange,grape"
sentence = "Hello World of Python"
lines = "第一行\n第二行\n第三行"
multiple = """a
b
c
d
"""

print("分割操作:")
print(f"CSV分割: {csv_data.split(',')}")           # ['apple', 'banana', 'orange', 'grape']
print(f"句子分割: {sentence.split()}")             # ['Hello', 'World', 'of', 'Python']
print(f"限制分割: {sentence.split(' ', 2)}")       # ['Hello', 'World', 'of Python']
print(f"行分割: {lines.splitlines()}")             # ['第一行', '第二行', '第三行']
print(f"multiple行分割:{multiple.splitlines()}")
print(f"从右边分割: {sentence.rsplit(' ', 2)}")    # ['Hello World', 'of', 'Python']

# 连接字符串
fruits = ['apple', 'banana', 'orange']
print(f"连接: {', '.join(fruits)}")                # apple, banana, orange
print(f"连接: {' - '.join(fruits)}")               # apple - banana - orange